|
In Pascal a
program is a single unit, called program, which contains variables,
functions, and procedures nested within. In C++, no such nesting occurs, and
the main function is the equivalent of the program. The type of
the value returned by a function is written before the function name, and
there is no special function keyword. The parentheses () signify a
function declaration to the compiler. They are present even if the function
has no arguments (as in main()). C++ does not distinguish between functions
and procedures. A procedure is simply a function returning void. The braces
{} are the equivalent of begin and end. In C++ all statements
are terminated with a semicolon, even the last statement of a block, but
there is no semicolon following the closing brace. The operation cout
<< is like the Pascal write; there is no special writeln
analog. To obtain a blank line, simply send a string containing a newline
‘\n’.
|